import React from 'react';
import { List as AntdList } from 'antd';
import type { ListProps as AntdListProps } from 'antd';
import { createStyles } from 'antd-style';

export interface ListProps<T> extends AntdListProps<T> {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  list: css`
    border-radius: ${token.borderRadius}px;
  `,
}));

const List = <T extends any>({ customClassName, className, ...restProps }: ListProps<T>) => {
  const { styles, cx } = useStyles();
  
  const listClassName = cx(
    className,
    customClassName,
    styles.list
  );

  return <AntdList className={listClassName} {...restProps} />;
};

// 导出子组件
List.Item = AntdList.Item;

export { List };
export default List;

